package com.example.designsoft.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.example.designsoft.R;

import java.util.List;

/**
 * author : Gyk
 * time   : 2021/3/19
 * todo   :
 */
public class BottomAdapter extends RecyclerView.Adapter<BottomAdapter.BottomViewHolder> {
    private Context mContext;
    private List<Integer> mList;

    public BottomAdapter(Context context, List<Integer> list) {
        this.mContext = context;
        this.mList = list;
    }

    @NonNull
    @Override
    public BottomViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(mContext).inflate(R.layout.item_bottom, parent, false);
        BottomViewHolder viewHolder = new BottomViewHolder(view);
        return viewHolder;
    }

    @Override
    public void onBindViewHolder(@NonNull BottomViewHolder holder, int position) {
        holder.mImgBottomIcon.setImageResource(mList.get(position));
    }

    @Override
    public int getItemCount() {
        return mList.size();
    }

    class BottomViewHolder extends RecyclerView.ViewHolder {

        private ImageView mImgBottomIcon;

        public BottomViewHolder(@NonNull View itemView) {
            super(itemView);
            mImgBottomIcon = itemView.findViewById(R.id.img_bottom_icon);
        }
    }
}
